using System;
using System.Data;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMRepair_SuggestionController
    {
        private clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdTMRepair_Suggestion(string keywords)
        {
            return cls.Search("sp_TMRepair_Suggestion", "@KeyWords", keywords);
        }
        public DataTable BindGirdTMRepair_SuggestionDetail(int id)
        {
            return cls.LayDuLieuParameter("sp_TMRepair_Suggestion_Detail", "@Repair_Suggestion_ID", id);
        }
        #endregion

        #region Insert
        public bool InsertTMRepair_Suggestion(clsTMRepair_SuggestionProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Repair_Suggestion_Voucher", data.Repair_Suggestion_Voucher);
            cls.AddParameter("@Repair_Suggestion_Date", data.Repair_Suggestion_Date);
            cls.AddParameter("@Vehicle_ID", data.Vehicle_ID);
            cls.AddParameter("@RepairMaterials_ID", data.RepairMaterials_ID);
            cls.AddParameter("@SymbolRepairMaterials_ID", data.SymbolRepairMaterials_ID);
            cls.AddParameter("@National_ID", data.National_ID);
            cls.AddParameter("@Repair_Suggestion_Content", data.Repair_Suggestion_Content);
            cls.AddParameter("@Repair_Suggestion_Quantity", data.Repair_Suggestion_Quantity);
            cls.AddParameter("@Repair_Suggestion_Rate", data.Repair_Suggestion_Rate);
            cls.AddParameter("@Repair_Suggestion_Cost", data.Repair_Suggestion_Cost);
            cls.AddParameter("@Repair_Suggestion_Note", data.Repair_Suggestion_Note);
            cls.AddParameter("@Repair_Suggestion_BrowseLv1", data.Repair_Suggestion_BrowseLv1);
            cls.AddParameter("@Repair_Suggestion_BrowseLv2", data.Repair_Suggestion_BrowseLv2);
            cls.ExecuteNonQuery("sp_TMRepair_Suggestion_Insert");
            return true;
        }
        #endregion

        #region Update
        public bool UpdateTMRepair_Suggestion(clsTMRepair_SuggestionProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Repair_Suggestion_ID", data.Repair_Suggestion_ID);
            cls.AddParameter("@Repair_Suggestion_Voucher", data.Repair_Suggestion_Voucher);
            cls.AddParameter("@Repair_Suggestion_Date", data.Repair_Suggestion_Date);
            cls.AddParameter("@Vehicle_ID", data.Vehicle_ID);
            cls.AddParameter("@RepairMaterials_ID", data.RepairMaterials_ID);
            cls.AddParameter("@SymbolRepairMaterials_ID", data.SymbolRepairMaterials_ID);
            cls.AddParameter("@National_ID", data.National_ID);
            cls.AddParameter("@Repair_Suggestion_Content", data.Repair_Suggestion_Content);
            cls.AddParameter("@Repair_Suggestion_Quantity", data.Repair_Suggestion_Quantity);
            cls.AddParameter("@Repair_Suggestion_Rate", data.Repair_Suggestion_Rate);
            cls.AddParameter("@Repair_Suggestion_Cost", data.Repair_Suggestion_Cost);
            cls.AddParameter("@Repair_Suggestion_Note", data.Repair_Suggestion_Note);
            cls.AddParameter("@Repair_Suggestion_BrowseLv1", data.Repair_Suggestion_BrowseLv1);
            cls.AddParameter("@Repair_Suggestion_BrowseLv2", data.Repair_Suggestion_BrowseLv2);
            cls.ExecuteNonQuery("sp_TMRepair_Suggestion_Update");
            return true;
        }
        public bool UpdateStatusTMRepair_Suggestion(clsTMRepair_SuggestionProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Repair_Suggestion_ID", data.Repair_Suggestion_ID);
            cls.AddParameter("@Repair_Suggestion_Status", data.Repair_Suggestion_Status);
            cls.ExecuteNonQuery("sp_TMRepair_Suggestion_UpdateStatus");
            return true;
        }
        #endregion

        #region Delete
        public bool DeleteTMRepair_Suggestion(int id)
        {
            cls.Delete("sp_TMRepair_Suggestion_Delete", "@Repair_Suggestion_ID", id);
            return true;
        }
        #endregion

        #region Filter

        public DataTable BindGirdTMRepair_Suggestion_FilterSoXe(int id)
        {
            return cls.LayDuLieuParameter("sp_TMRepair_Suggestion_FilterSoXe", "@Vehicle_ID", id);
        }

        public DataTable BindGirdTMRepair_Suggestion_FilterByDate(string DateBegin, string EndBegin)
        {
            return cls.FillterDay("sp_TMRepair_Suggestion_FilterByDate", DateBegin, EndBegin);
        }

        #endregion
    }
}